<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<!-- Copyright 1997 The Open Group, All Rights Reserved -->
<title>t_close</title>
</head><body bgcolor=white>
<center>
<font size=2>
The Single UNIX &reg; Specification, Version 2<br>
Copyright &copy; 1997 The Open Group

</font></center><hr size=2 noshade>
<h4>NAME</h4><blockquote>
t_close - close a transport endpoint
</blockquote><h4>SYNOPSIS</h4><blockquote>
<pre><code>

#include &lt;<a href="xti.h.html">xti.h</a>&gt;

int t_close(
    int fd)
</code>
</pre>
</blockquote><h4>DESCRIPTION</h4><blockquote>
<pre>
<P><table  bordercolor=#000000 border=1 align=center><tr valign=top><th align=center><b>Parameters</b>
<th align=center><b>Before call</b>
<th align=center><b>After call</b>
<tr valign=top><td align=left>fd
<td align=center>x
<td align=center>/
</table>
</pre>
<p>
The
<i>t_close()</i>
function informs the transport provider that the user is finished
with the transport endpoint specified by
<I>fd</I>,
and frees any local library resources associated with the endpoint.
In addition,
<i>t_close()</i>
closes the file associated with the transport endpoint.
<p>
The function
<i>t_close()</i>
should be called from the
T_UNBND
state (see
<i><a href="t_getstate.html">t_getstate()</a></i>).
However, this function does not check state information,
so it may be called from any state to close a transport endpoint.
If this occurs, the local library resources associated with the endpoint
will be freed automatically.  In addition,
<i><a href="close.html">close()</a></i>
will be issued for that file descriptor; if there are no other
descriptors in this process or in another process which references
the communication endpoint, any connection that may be associated
with that endpoint is broken. The connection may be terminated
in an orderly or abortive manner.
<p>
A
<i>t_close()</i>
issued on a connection endpoint may cause data previously sent,
or data not yet received, to be lost.
It is the responsibility of the transport user to ensure that data is received
by the remote peer.
<p>
For advice on how to write protocol-independent applications, see
<xref href=writpisw></xref>.
For information on protocol-specific behaviour of
<i>t_close()</i>,
see the XTI Appendix for the relevant transport provider.
</blockquote><h4>VALID STATES</h4><blockquote>
ALL - apart from T_UNINIT
</blockquote><h4>ERRORS</h4><blockquote>
On failure,
<I>t_errno</I>
is set to the following:
<dl compact>

<dt>[TBADF]<dd>The specified file descriptor does not refer to a transport endpoint.

<dt>[TPROTO]<dd>This error indicates that a communication problem has been detected between
XTI and the transport provider for which there is no other suitable XTI
error
<I>(t_errno)</I>.

<dt>[TSYSERR]<dd>A system error has occurred during execution of this function.

</dl>
</blockquote><h4>RETURN VALUE</h4><blockquote>
Upon successful completion, a value of 0 is returned.  Otherwise,
a value of -1 is returned and
<I>t_errno</I>
is set to indicate an error.
</blockquote><h4>SEE ALSO</h4><blockquote>
<i><a href="t_getstate.html">t_getstate()</a></i>,
<i><a href="t_open.html">t_open()</a></i>,
<i><a href="t_unbind.html">t_unbind()</a></i>.
</blockquote><hr size=2 noshade>
<center><font size=2>
UNIX &reg; is a registered Trademark of The Open Group.<br>
Copyright &copy; 1997 The Open Group
<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]

</font></center><hr size=2 noshade>
</body></html>
